<template>
	<div class="cartcontrol">
		<div class="cart-decrease" @click="reduce()">-</div>
		<div class="cart-count">{{data.count}}</div>
		<div class="cart-add" @click="refuel()">+</div>
	</div>
</template>
carcontrol
<script>
	import Vue from "vue"
	export default {
		props: [
			'data'
		],
		created() {},
		data() {
			return {

			}
		},
		methods: {
			reduce() {
				if(this.data.count == 1) {
//					alert('该商品一件起售');
					return;
				}
				this.data.count--;
			},
			refuel() {
				this.data.count++;
			}
		}
	}
</script>

<style scoped="scoped">
	.cartcontrol>div {
		line-height: 30px;
	}
	
	.cart-decrease {
		width: 70%;
		height: 30px;
		background-color: #f7f7f7;
		border-top-left-radius: 5px;
		border-bottom-left-radius: 5px;
		text-align: center;
	}
	
	.cart-count {
		width: 70%;
		height: 30px;
		margin: 0 2%;
		background-color: #e6e6e6;
		text-align: center;
	}
	
	.cart-add {
		width: 70%;
		height: 30px;
		background-color: white;
		border-top-right-radius: 5px;
		border-bottom-right-radius: 5px;
		background-color: #e6e6e6;
		text-align: center;
	}
</style>